import { AppCTX } from "../../types/koaExtend";
import Router from "koa-router";
import { getStoreWithStatAndEndorsementForUser } from "../../service/storeService";
import { isString, isUndefined, _pick, _omit } from "mmb";
const router = new Router();

// 获取品牌信息
router.get("/usr/store/:storeId", async (ctx: AppCTX, next) => {
  const { userId } = ctx;
  const { storeId } = ctx.params;
  const storeWithStat = await getStoreWithStatAndEndorsementForUser(storeId, userId);
  ctx.body = {
    ..._pick(
      storeWithStat,
      "id",
      "name",
      "pic",
      "intro",
      "homepageBg",
      "fansCount",
      "publishActivityCount",
      "isEndorsementEntranceDisplay",
      "endorseSpokesmanId"
    ),
  };
});

export default router;